<div class="dialogs">
    @foreach($comments as $comment)
    <div class="itemdiv dialogdiv">
        <div class="user">
            @if($comment->type < 1000)
            <img alt="Alexa's Avatar" src="/assets/avatars/avatar1.png" />
            @else
            <img alt="Alexa's Avatar" src="/assets/avatars/avatar2.png" />
            @endif
        </div>

        <div class="body">
            <div class="time">
                <i class="icon-time"></i>
                <span class="green">{{$comment->created_at}}</span>
            </div>

            <div class="name">
                <a href="#">
                @if($comment->type < 1000)
                学生
                @else
                老师
                @endif
                </a>
            </div>
            <div class="text">{{$comment->comment}}</div>

            <div class="tools">
                <a href="#" class="btn btn-minier btn-info">
                    <i class="icon-only icon-share-alt"></i>
                </a>
            </div>
        </div>
    </div>
    @endforeach
</div>

<form action="/comment" id="comment_form" name="comment_form" method="POST">
    <div class="form-actions">
    {{ csrf_field() }}
    <div class="input-group">
        <input placeholder="发送意见" type="text" class="form-control" name="comment" />
        <input type="hidden" name="student_id" value="{{$commentInfo['student_id']}}"/>
        <input type="hidden" name="type" value="{{$commentInfo['type']}}"/>
        <span class="input-group-btn">
            <button onClick="sendComment()" class="btn btn-sm btn-info no-radius" type="button">
                <i class="icon-share-alt"></i>发送
            </button>
        </span>
    </div>
  </div>
</form>

<script type="text/javascript">
   if("ontouchend" in document) document.write("<script src='/assets/js/jquery.mobile.custom.min.js'>"+"<"+"script>");
   function sendComment() {

       event.preventDefault(); 
       document.getElementById('comment_form').submit();
   }
</script>
<script src="/assets/js/bootstrap.min.js"></script>
<script src="/assets/js/typeahead-bs2.min.js"></script>

<!-- page specific plugin scripts -->

<!--[if lte IE 8]>
<script src="/assets/js/excanvas.min.js"></script>
<![endif]-->

<script src="/assets/js/jquery-ui-1.10.3.custom.min.js"></script>
<script src="/assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="/assets/js/jquery.slimscroll.min.js"></script>


<!-- inline scripts related to this page -->

<script type="text/javascript">
jQuery(function($) {
    @if($comments->count() > 0)
    $('.dialogs,.comments').slimScroll({
        height: '150px',
        alwaysVisible : false
    });
    @endif
})
</script>


